-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AWS Lambda handlers #404
Conversation
🦋 Changeset detectedLatest commit: 8787d92 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #404 +/- ##
=======================================
Coverage ? 82.64%
=======================================
Files ? 95
Lines ? 3497
Branches ? 587
=======================================
Hits ? 2890
Misses ? 600
Partials ? 7 ☔ View full report in Codecov by Sentry. |
37d7948
to
3fb73af
Compare
Add exports Update JSDocs Add tests for register handler Remove `saleorDomain` from type Rename aws-lambda file Throw errors in adapters, instead of resolving to null Add AWS lambda tests Fix lambda types Fix lambda headers Add lambda manifest test, fix headers resolution Fetch API: add tests for protected handler, fix types Add tests for lambda protected handler, fix types Simplify Fetch API adapter logic, add tests for adapter Add lambda tests Refactor sync webhook names, refactor types Add web api sync webhook tests Add async webhook tests Add lambda sync webhook test Fix types Removed unused functions Remove fetch-api
3fb73af
to
9f98a79
Compare
Released snapshot build with Install it with: pnpm add @saleor/app-sdk@0.0.0-pr-20250206120033 |
Released snapshot build with Install it with: pnpm add @saleor/app-sdk@0.0.0-pr-20250206135700 |
Released snapshot build with Install it with: pnpm add @saleor/app-sdk@0.0.0-pr-20250207113756 |
return null; | ||
} | ||
|
||
return JSON.parse(this.request.body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Is it save to run JSON.parse
without proper error handling in case this.request.body
will has invalid json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we want it to throw error so that we know that request was invalid because of malformated JSON, not that the request was empty (if we would return null).
Ideally I would use neverthrow
so that we don't throw exceptions, but I didn't want to introduce another dependency ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In places we use getBody
we have try...catch
This PR adds handlers for AWS Lambda platform for events originating from HTTP events (e.g. Lambda URL, API Gateway).
Example implementation using this PR: https://github.com/witoszekdev/saleor-app-lambda-template